<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>wiidata</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="wiiconnect.html" title="wiiconnect" />
    <link rel="next" href="wiirange.html" title="wiirange" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">wiidata</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="wiiconnect.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="wiirange.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="wiidata"></a>
      <div class="titlepage"></div>
      <a id="Indexwiidata" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">wiidata</span>
        </h2>
        <p>wiidata — 
      Reads data fields from a number of external Nintendo Wiimote controllers.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp168306112"></a>
        <h2>Description</h2>
        <p>
       Reads data fields from upto four external Nintendo Wiimote controllers.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp168310208"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">kres <span class="command"><strong>wiidata</strong></span> kcontrol[, knum]</pre>
      </div>
      <div class="refsect1">
        <a id="idp168312416"></a>
        <h2>Initialization</h2>
        <p>
      This opcode must be used in conjuction with
      a running <span class="emphasis"><em>wiiconnect</em></span> opcode.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp168314048"></a>
        <h2>Performance</h2>
        <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
          <table border="0" summary="Note">
            <tr>
              <td rowspan="2" align="center" valign="top" width="25">
                <img alt="[Note]" src="images/note.png" />
              </td>
              <th align="left">Note</th>
            </tr>
            <tr>
              <td align="left" valign="top">
                <p>
       Please note that these opcodes are currently only supported on
       Linux.
     </p>
              </td>
            </tr>
          </table>
        </div>
        <p>
     <span class="emphasis"><em>kcontrol</em></span> -- the code for which control to read
   </p>
        <p>
     <span class="emphasis"><em>knum</em></span> -- the number of the which Wiimote to
     access, which defaults to the first one.
   </p>
        <p>
     On each access a particular data item of the Wiimote is read.
     The currently implemented controls are given below, together with
     the macro name defined in the file <span class="emphasis"><em>wii_mac</em></span>:
   </p>
        <p>
     0 (WII_BUTTONS): returns a bit pattern for all buttons that were pressed.
   </p>
        <p>
1 (WII_TWO): returns 1 if the button has just been pressed, or 0 otherwise.
   </p>
        <p>
2 (WII_ONE): as above.
   </p>
        <p>
3 (WII_B): as above.
   </p>
        <p>
4 (WII_A): as above.
   </p>
        <p>
5 (WII_MINUS): as above.
   </p>
        <p>
8 (WII_HOME): as above.
   </p>
        <p>
9 (WII_LEFT): as above.
   </p>
        <p>
10 (WII_RIGHT): as above.
   </p>
        <p>
11 (WII_DOWN): as above.
   </p>
        <p>
12 (WII_UP): as above.
   </p>
        <p>
13 (WII_PLUS): as above.
   </p>
        <p> 
If the control number is 100 more than one of these button codes then
the current state of the button is returned.  Macros with names
like WII_S_TWO etc are defined for this.
</p>
        <p> 
If the control number is 200 more than one of these button codes then
the return value is 1 if the button i held and 0 otherwise.  Macros with names
like WII_H_TWO etc are defined for this.
</p>
        <p> 
If the control number is 300 more than one of these button codes then
the value is 1 if the button has just been released, and 0 otherwise.
Macros with names like WII_R_TWO etc are defined for this.
</p>
        <p>
     20 (WII_PITCH): The pitch of the Wiimote.  The value is in
     degrees between -90 and +90, unless modified by a <span class="emphasis"><em>wiirange</em></span> call.
   </p>
        <p>
     21 (WII_ROLL): The roll of the Wiimote.  The value is in
     degrees between -90 and +90, unless modified by a <span class="emphasis"><em>wiirange</em></span> call.
   </p>
        <p>
     23 (WII_FORCE_X): The force applied to the Wiimote in the three axes.
   </p>
        <p>
     24 (WII_FORCE_Y):
   </p>
        <p>
     25 (WII_FORCE_Z):
   </p>
        <p>
     26 (WII_FORCE_TOTAL): The total magnitude of the force applied to
     the Wiimote.
   </p>
        <p>
     27 (WII_BATTERY): The percent of the battery that remains.
   </p>
        <p>
     28 (WII_NUNCHUK_ANG): The angle of the nunchuk joystick in degrees.
   </p>
        <p>
     29 (WII_NUNCHUK_MAG): The magnitude of the nunchuk joystick from neutral.
   </p>
        <p>
     30 (WII_NUNCHUK_PITCH):  The pitch of the nunchuk in degrees, in
     range -90 to +90 unless modified by a <span class="emphasis"><em>wiirange</em></span> call.
   </p>
        <p>
     31 (WII_NUNCHUK_ROLL):  The roll of the nunchuk in degrees, in
     range -90 to +90 unless modified by a <span class="emphasis"><em>wiirange</em></span> call.
   </p>
        <p>
     33 (WII_NUNCHUK_Z): The state of the nunchuk Z button.
   </p>
        <p>
     34 (WII_NUNCHUK_C): The state of the nunchuk C button.
   </p>
        <p>
     35 (WII_IR1_X): The infrared pointing of the Wiimote.
   </p>
        <p>
     36 (WII_IR1_Y):
   </p>
        <p>
     37 (WII_IR1_Z):
    </p>
      </div>
      <div class="refsect1">
        <a id="idp168403184"></a>
        <h2>Examples</h2>
        <p>
      See the example for <a class="link" href="wiiconnect.html" title="wiiconnect"><em class="citetitle">wiiconnect</em></a>.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp168405344"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="wiiconnect.html" title="wiiconnect"><em class="citetitle">wiiconnect</em></a>,
      <a class="link" href="wiirange.html" title="wiirange"><em class="citetitle">wiirange</em></a>,
      <a class="link" href="wiisend.html" title="wiisend"><em class="citetitle">wiisend</em></a>,
     </p>
      </div>
      <div class="refsect1">
        <a id="idp168409408"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: John ffitch</td>
          </tr>
          <tr>
            <td>Codemist Ltd</td>
          </tr>
          <tr>
            <td>2009</td>
          </tr>
        </table>
        <p>
    </p>
        <p>New in version 5.11</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="wiiconnect.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="wiirange.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">wiiconnect </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> wiirange</td>
        </tr>
      </table>
    </div>
  </body>
</html>
